<template>
  <Dialog v-model="wxDialog" title="已推微信详情">
    <el-table :data="list" style="width: 100%">
      <el-table-column prop="userName" label="接收人"> </el-table-column>
      <el-table-column prop="contentDescription" label="消息内容" show-overflow-tooltip>
      </el-table-column>
      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        :formatter="dateFormatter"
      />
    </el-table>
    <Pagination
      :total="total"
      v-model:page="queryParams.pageNo"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />
  </Dialog>
</template>

<script setup>
import { templateRecord } from '@/api/call/aiCall/index.ts'
import { dateFormatter } from '@/utils/formatTime'

const wxDialog = ref(false)

const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
  type: 1,
  groupId: ''
})
const list = ref([])
const total = ref(0)

const getList = async () => {
  const data = await templateRecord(queryParams)
  list.value = data.list
  total.value = data.total
}

const open = (id) => {
  wxDialog.value = true
  queryParams.pageNo = 1
  queryParams.groupId = id
  getList()
}
defineExpose({ open })
</script>

<style lang="scss" scoped></style>
